<!doctype html>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=1280, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
	<meta name="renderer" content="webkit|ie-stand|ie-comp">
	<meta http-equiv="Access-Control-Allow-Origin" content="*" />
	<title>在线进销存</title>
	<link href="/public/static/admin/ind/release/css/common.css?ver=20150522" rel="stylesheet" type="text/css">
	<link href="/public/static/admin/ind/release/css/blue/ui.min.css?ver=20150522" rel="stylesheet">
	<script src="/public/static/admin/ind/release/js/common/libs/jquery/jquery-1.10.2.min.js"></script>
	<!-- <script src="/public/static/admin/ind/release/js/common/libs/json3.min.js"></script> -->
	<script src="/public/static/admin/ind/release/js/common/common.js?ver=20150522"></script>
	<!--<script src="/public/static/admin/ind/release/js/common/grid.js?ver=20150522"></script>
<script src="/public/static/admin/ind/release/js/common/plugins.js?ver=20150522"></script>
<script src="/public/static/admin/ind/release/js/common/plugins/jquery.dialog.js?self=true&ver=20150522"></script> -->


	<link rel="stylesheet" type="text/css" href="/public/static/admin/easyui/jeasyui/themes/material/easyui.css">
	<!-- <link rel="stylesheet" href="/public/static/admin/easyui/layui/theme/default/layer.css" /> -->
	<link rel="stylesheet" type="text/css"
		href="/public/static/admin/easyui/layui-v2.6.8/css/modules/layer/default/layer.css?v=3.1.1 ">

	<link href="/public/static/admin/youshang/css/common.css" rel="stylesheet" type="text/css">
	<link href="/public/static/admin/youshang/css/print.css" rel="stylesheet" type="text/css">
	<link href="/public/static/admin/youshang/css/style.css" rel="stylesheet" type="text/css">

	<link href="/public/static/admin/youshang/css/ui.min.css" rel="stylesheet">
	<link rel="stylesheet" href="/public/static/admin/easyui/layui-v2.6.8/css/layui.css">
	<link rel="stylesheet" type="text/css" href="/public/static/admin/easyui/jeasyui/themes/icon.css">

	<style type="text/css">
		body {
			font: 12px/1.5 arial, \5b8b\4f53 !important;
		}

		/*数据表格页眉不显示*/
		.gridghead_0 {
			width: 355px;
			display: none;
		}

		/*数据表格页角高度*/
		.jqfoot {
			height: 36px;
		}

		/* 拖动表格列宽样式 */
		.ui-jqgrid-resize-mark {
			position: absolute !important;
		}

		.l-tab-links li.l-selected a {
			color: #fff !important;
		}

		.l-tab-links-item-close {
			background-position: 0 -12px !important;
			top: 8px !important;
		}

		.l-tab-links .l-tab-links-item-close-over {
			background-color: #fff !important;
			border-radius: 50% !important;
		}

		/* 列表筛选条件--状态内容的层级 */
		.ui-btn-menu .con {
			z-index: 101;
		}

		.ui-btn-menu {
			z-index: auto;
		}


		/* 点击菜单弹窗样式 */
		.PopuptipBox {
			width: 100%;
			height: auto;
			display: flex;
			align-items: center;
			padding: 15px 20px;
			box-sizing: border-box;
		}

		.PopuptipBox .leftImg {
			flex: none;
			width: 108px;
			height: auto;
		}

		.PopuptipBox .rightText {
			flex: 1;
			width: calc(100% - 108px);
			padding: 20px 20px;
			box-sizing: border-box;
			font-size: 14px;
		}

		.PopuptipBox .rightText .re-initialize h3 {
			font-weight: bold;
			color: #555;
		}

		.PopuptipBox .rightText .re-initialize ul {
			padding-left: 0;
		}

		.PopuptipBox .rightText .re-initialize ul li {
			list-style: none;
			font-size: 14px;
			line-height: 2.3;
			color: #555;
		}

		.PopuptipBox .rightText .chk_blue {
			padding-left: 0;
			display: flex;
		}

		.PopuptipBox .rightText .chk_blue input {
			display: inline-block;
			width: 16px;
			height: 16px;
		}

		.PopuptipBox .rightText .chk_blue>label {
			padding-left: 10px;
			font-size: 12px;
			line-height: 16px;
			height: 16px;
		}

		.PopuptipBox .rightText .check-confirm {
			visibility: visible;
			font-size: 12px;
			color: #555;
			padding-left: 20px;
		}

		.layui-layer-btn.layui-layer-btn- {
			background-color: #f8f8f8;
		}

		/* 备注输入框的字体颜色 */
		.ui-input-ph {
			color: #555 !important;
		}

		.ui-input-ph::-webkit-input-placeholder {
			color: #c5c5c5;
		}
	</style>

	<script type="text/javascript">
		var DOMAIN = document.domain;
		var WDURL = "/index.php";
		var SCHEME = "blue";
		try {
			document.domain = '/';
		} catch (e) {

		}
		//ctrl+F5 增加版本号来清空iframe的缓存的
		$(document).keydown(function (event) {
			/* Act on the event */
			if (event.keyCode === 116 && event.ctrlKey) {
				var defaultPage = Public.getDefaultPage();
				var href = defaultPage.location.href.split('?')[0] + '?';
				var params = Public.urlParam();
				params['version'] = Date.parse((new Date()));
				for (i in params) {
					if (i && typeof i != 'function') {
						href += i + '=' + params[i] + '&';
					}
				}
				defaultPage.location.href = href;
				event.preventDefault();
			}
		});

//添加end
	</script>
	<script src="/public/static/admin/youshang/js/grid.js"></script>
	<script src="/public/static/admin/easyui/layui-v2.6.8/lay/modules/layer.js"></script>
	<script src="/public/static/admin/easyui/layui-v2.6.8/layui.js"></script>

	<!-- <script type="text/javascript" src="/public/static/admin/easyui/layui/layer.js"></script> -->

	<script>
		$(document).ready(function () {
			layui.use(['form', 'layedit', 'laydate'], function () {
				var form = layui.form
					, layer = layui.layer
					, layedit = layui.layedit
					, laydate = layui.laydate;
			});
		})
	</script>

	<script>
		// 页面跳转（新增）
		function addPage(_href, tabid, tabTxt) {
			parent.tab.addTabItem({
				tabid: tabid,
				text: tabTxt,
				url: _href
			})
		}

		function del(id) {

			layer.confirm('您确定要删除吗？', {
				btn: ['确定', '取消'], //按钮
				title: "删除提示",
			}, function () {
				// layer.msg('确定');
				$.ajax({
					type: 'POST',
					url: "del.html",
					data: { id: id },
					dataType: "json",
					async: false,
					error: function (request) {
						layer.msg("发送请求失败！");
					},
					success: function (data) {
						if (data.status == 1) {
							layer.msg(data.msg);
							// $("#grid").jqGrid("clearGridData");
							// $("#grid").jqGrid("setGridParam", {
							// 	url: 'index.html?ajax=100',
							// }).trigger("reloadGrid");
							reload();
						} else {
							layer.msg(data.msg);
						}

					}
				});
			}, function () {
				// layer.msg('取消');
			});

		}

		function lopen(url, title, width, height, saveurl = "save.html") {
			layer.open({
				type: 2,
				title: title,
				shadeClose: true,
				shade: 0.3,
				maxmin: true, //开启最大化最小化按钮
				btn: ['确定', '取消'],
				area: [width, height],
				content: url,
				yes: function (index, layero) {
					var body = layer.getChildFrame('body', index);
					var postdata = body.find('#manage-form').serialize();
					$.ajax({
						type: 'POST',
						//url: "save.html",
						url: saveurl,
						data: postdata,
						dataType: "json",
						async: false,
						error: function (request) {
							alert("发送请求失败！");
						},
						success: function (data) {
							if (data.status == 1) {
								layer.msg(data.msg);
								layer.close(index);
								reload();
							} else {
								layer.msg(data.msg);
							}
						}
					});
				}
			});
		}


		function reload() {
			$("#grid").jqGrid("clearGridData");
			$("#grid").jqGrid("setGridParam", {
				url: 'index.html?ajax=100',
			}).trigger("reloadGrid");
			$("#grid1").jqGrid("clearGridData");
			$("#grid1").jqGrid("setGridParam", {
				url: 'multiindex.html?ajax=100',
			}).trigger("reloadGrid");
		}

		function f5(url) {
			$("#grid").jqGrid("clearGridData");
			$("#grid").jqGrid("setGridParam", {
				url: url,
			}).trigger("reloadGrid");
		}

	
		// 客户类别 的 点击切换
		$(function () {
			$("#assisting-category-select .ui-tab li").on("click", function () {
				// console.log("点击");
				var dataId = $(this).attr("data-id");
				var dataUrl = $(this).attr("data-url");
				var dataText = $(this).text()+"类别";
				var tabid = $("body",parent.document).find('#page-tab .l-tab-links li.l-selected').attr("tabid");
				if(dataUrl != undefined){
					$(this).addClass("cur").siblings().removeClass("cur");
					location.href = dataUrl;
					$("body",parent.document).find('#page-tab .l-tab-links li[tabid='+tabid+'] a').html(dataText); 

				}else{
					return false;
				}
			});
		})

		function unserialize(url) {
			if (url.indexOf("?") > -1) {
				url = url.substring(1);
			}
			var parts = url.split("&");
			var json = {};
			parts.forEach(function (item) {
				if (item.indexOf("=") > -1) {
					var itemArray = item.split("=");
					json[itemArray[0]] = decodeURI(itemArray[1]);
				}
			});
			return json;
		}

	</script>

	<script type="text/javascript">

		// 导入
		function onImport(url, title, width, height) {
			layer.open({
				type: 2,
				title: title,
				shadeClose: true,
				shade: 0.3,
				maxmin: false, //开启最大化最小化按钮
				btn: false,
				area: [width, height],
				content: url,
				btn1: function (index, layero) {

				},
				btn2: function (index, layero) {

				},
				btn3: function (index, layero) {

				},
			});
		};
		// 高级搜索
		function heightSearch(url, title, width, height) {
			layer.open({
				type: 2,
				title: title,
				shadeClose: true,
				shade: 0.3,
				maxmin: true, //开启最大化最小化按钮
				btn: ['重置', '查询', '关闭'],
				area: [width, height],
				content: url,
				btn1: function (index, layero) {
					document.getElementById("layui-layer-iframe" + index).contentWindow.location.reload();
					return false;
				},
				btn2: function (index, layero) {
					var body = layer.getChildFrame('body', index);
					return false;
				},
				btn3: function (index, layero) {
					layer.close(index);
					return false;
				},
				success: function (layero, index) {
					//渲染按钮样式
					$(".layui-layer-btn .layui-layer-btn0").css({
						"background": "-webkit-gradient(linear,0 0,0 100%,from(#f2f2f2),to(#f4f4f4))",
						"float": "left",
						"color": "#555",
						"border": "1px solid #c1c1c1",
					});
					$(".layui-layer-btn .layui-layer-btn1").css({
						"background": "linear-gradient(to bottom,#4dc2e6 0,#38B3EB 100%)",
						"color": "#fff",
						"border": "1px solid #38B3EB"

					});
				}
			});
		};

		// 选择商品
		function choose_goods(url, obj, callback) {
			var o = $(obj);
			var garr = new Array();
			garr['status'] = 0;
			layer.open({
				type: 2,
				title: "选择商品",
				shadeClose: true,
				shade: 0.3,
				maxmin: true, //开启最大化最小化按钮
				area: ['900px', '580px'],
				fixed: false, //不固定
				btn: ['新增商品', '选中', '选中并关闭', '取消'],
				//btn: ['btn1','btn2','btn3', 'btn4'],
				content: url,
				btn1: function (index, layero) {
					//layer.msg("1");
					parent.tab.addTabItem({
						tabid: "purchase",
						text: "新增商品",
						url: "/admin/goods/add.html",
					})
					return false;
					// garr['btn'] = 1;
					// garr['status'] = 1;
					// callback(garr);
					// return false;
					//layer.close(index);
				},
				btn2: function (index, layero) {
					garr['btn'] = 2;
					//按钮【按钮二】的回调
					var body = layer.getChildFrame('body', index);
					var goodid = body.find('input[name="goodid"]:checked').val();
					if (goodid == '' || goodid == null) {
						layer.msg("请选择商品");
					}

					garr['status'] = 1;
					callback(garr);
					return false;
				},
				btn3: function (index, layero) {
					garr['btn'] = 3;
					garr['status'] = 0;
					var body = layer.getChildFrame('body', index);
					//var goodid = body.find('input[name="goodid"]:checked').val();
					var ids = body.find("#grid").jqGrid('getGridParam', 'selarrrow');

					if (ids == '' || ids == null) {
						layer.msg("请选择商品");
						garr['status'] = 0;
						callback(garr);
						return false;
					} else {
						//alert(ids);
						//return false;
						//获取商品信息
						$.get("/admin/basic/one_goods.html", { ids: ids }, function (data, state) {
							if (data.status == 1) {

								garr['status'] = 1;
								garr['data'] = data;
								layer.close(index);
								callback(garr);
							}
						})
					}
					//     	if (goodid == '' || goodid == null) {
					//     		layer.msg("请选择商品");
					//     		garr['status'] = 0;
					//     		callback(garr);
					// return false;
					//     	}
					//获取商品信息
					//    $.get("/admin/basic/one_goods.html", { id: goodid }, function (data, state) {
					//    	if (data.status == 1) {

					//   garr['status'] = 1;
					//   garr['data'] = data;
					// layer.close(index);
					//         callback(garr);
					//     } 
					// })

					return false;
				},
				btn4: function (index, layero) {
					//garr['btn'] = 4;
					layer.close(index);
					//garr['status'] = 1;
					//callback(garr);
					return false;
					//return garr;
					//return false;
				},
				success: function (layero, index) {
					// debugger
					//渲染按钮样式
					addIconforBtnstyle();
				}
			});
		}


		// 选择商品1(父级弹窗)
		function choose_goods_parent(url, obj, callback) {
			var o = $(obj);
			var garr = new Array();
			garr['status'] = 0;
			parent.layer.open({
				type: 2,
				title: "选择商品",
				shadeClose: true,
				shade: 0.3,
				maxmin: true, //开启最大化最小化按钮
				area: ['900px', '580px'],
				fixed: false, //不固定
				btn: [ '确定', '取消'],
				//btn: ['btn1','btn2','btn3', 'btn4'],
				content: url,
				
				btn1: function (index, layero) {
					garr['btn'] = 3;
					garr['status'] = 0;
					var body = parent.layer.getChildFrame('body', index);
					//var goodid = body.find('input[name="goodid"]:checked').val();
					var ids = body.find("#grid").jqGrid('getGridParam', 'selarrrow');

					if (ids == '' || ids == null) {
						parent.layer.msg("请选择商品");
						garr['status'] = 0;
						callback(garr);
						return false;
					} else {
						//alert(ids);
						//return false;
						//获取商品信息
						$.get("/admin/basic/one_goods.html", { ids: ids }, function (data, state) {
							if (data.status == 1) {

								garr['status'] = 1;
								garr['data'] = data;
								parent.layer.close(index);
								callback(garr);
							}
						})
					}
					//     	if (goodid == '' || goodid == null) {
					//     		layer.msg("请选择商品");
					//     		garr['status'] = 0;
					//     		callback(garr);
					// return false;
					//     	}
					//获取商品信息
					//    $.get("/admin/basic/one_goods.html", { id: goodid }, function (data, state) {
					//    	if (data.status == 1) {

					//   garr['status'] = 1;
					//   garr['data'] = data;
					// layer.close(index);
					//         callback(garr);
					//     } 
					// })

					return false;
				},
				btn2: function (index, layero) {
					//garr['btn'] = 4;
					layer.close(index);
					//garr['status'] = 1;
					//callback(garr);
					return false;
					//return garr;
					//return false;
				}
			});
		}


		//JS部分
		//渲染方法
		function addIconforBtnstyle() {
			// debugger
			var btn1 = $(".layui-layer-btn .layui-layer-btn0");
			var btn2 = $(".layui-layer-btn .layui-layer-btn1");
			var btn3 = $(".layui-layer-btn .layui-layer-btn2");
			var btn4 = $(".layui-layer-btn .layui-layer-btn3");

			btn1.css({
				//css样式
				//"属性名":"属性值",
				"background": "linear-gradient(to bottom,#4dc2e6 0,#38B3EB 100%)",
				"float": "left",

			})
			btn2.css({
				//css样式
				"background": "linear-gradient(to bottom,#4dc2e6 0,#38B3EB 100%)",
				"color": "#fff",
			})
			btn3.css({
				//css样式
				"background": "linear-gradient(to bottom,#4dc2e6 0,#38B3EB 100%)",
				"color": "#fff",
			})
			btn3.css({
				//css样式
			})
		}
	</script>


</head>

<body>
	{include file="admin@public/function" /}